package com.zzf.concurrent.example.single;

import lombok.extern.slf4j.Slf4j;

/**
 * @author GaoFeng2017
 * @date 2019/8/12 19:28
 */
@Slf4j
public class SingleBeanExample {
    public static void main(String[] args) {

        /*for (int i = 0; i < 100; i++) {
            new Thread(() -> {
                TimeUtil.sleep((long) (Math.random() * 1000));
                DoubleCheckSingleBean doubleCheckSingleBean = DoubleCheckSingleBean.getDoubleCheckSingleBean();
                log.info("doubleCheckSingleBean{} is {}", Thread.currentThread().getName(), doubleCheckSingleBean.hashCode());
            }).start();
        }
*/
        /*for (int i = 0; i < 10; i++) {
            DirectInitSingleBean instance = DirectInitSingleBean.getInstance();
            log.info("DirectInitSingleBean{} is {}", i, instance);
        }

        for (int i = 0; i < 10; i++) {
            EnumSingleBean enumSingleBean = EnumSingleBean.getInstance();
            log.info("EnumSingleBean{} is {}", i, enumSingleBean);
        }

        for (int i = 0; i < 10; i++) {
            StaticLoadSingleBean staticLoadSingleBean = StaticLoadSingleBean.getInstance();
            log.info("StaticLoadSingleBean{} is {}", i, staticLoadSingleBean);
        }*/

        EnumSingleBean enumSingleBean = EnumSingleBean.getInstance();

    }
}
